package com.scenic.rd_android.threerd.rxjava_retrofit;

import java.util.Map;

import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.HeaderMap;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.QueryMap;

/**
 * Created by scenic on 16/9/1.
 */
public interface APITest {

    @GET("user/list?sort=desc")
    Call<TestJavaBeans.GitHubUserEntity> test2();

    @GET("group/{id}/users")
    Call<TestJavaBeans.GitHubUserEntity> test3(@Path("id") String id);

    @GET("group/{id}/users")
    Call<TestJavaBeans.GitHubUserEntity> test4(@Path("id") String groupId, @QueryMap Map<String, String> options);


    @Headers({
            "header1:key1",
            "header2:key2"
    })
    @FormUrlEncoded
    @POST("ScenicServer/SelfDebugServlet")
    Call<TestJavaBeans.SelfDebugBean> testPost1(@Field("name") String name, @Field("passwod") String passwd);


    @FormUrlEncoded
    @POST("ScenicServer/SelfDebugServlet")
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    Call<TestJavaBeans.SelfDebugBean> testPost2(@FieldMap Map<String, String> op);


    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @POST("ScenicServer/SelfDebugServlet")
    Call<TestJavaBeans.SelfDebugBean> testPost3(@Body RequestBody body);


    @Headers({
            "channel_type:1",
            "device_id:00-26-C7-33-97-EE",
            "timespan:11945223222"
    })
    @FormUrlEncoded
    @POST("ScenicServer/SelfDebugServlet")
    Call<TestJavaBeans.GetServerInfo> getServerInfo(@Field("cusid") String cusid);


    @FormUrlEncoded
    @Headers({
            "channel_type:1"

    })
    @POST("ScenicServer/SelfDebugServlet")
    Call<TestJavaBeans.GetServerInfo> getServerInfo2(@Field("cusid") String cusid,
                                                     @Header("channel_type") String channelTyp,
                                                     @Header("device_id") String deviceId,
                                                     @Header("timespan") String timeSpan);


    @FormUrlEncoded
    @POST("ScenicServer/SelfDebugServlet")
    Call<TestJavaBeans.GetServerInfo> getServerInfo3(@Field("cusid") String cusid,
                                                     @HeaderMap Map<String, String> map);


    @Headers({
            "channel_type:1",
            "device_id:00-26-C7-33-97-EE",
            "timespan:11945223222"
    })
    @FormUrlEncoded
    @POST("ServiceHosting/pre-server/GetServerInfo")
    rx.Observable<TestJavaBeans.GetServerInfo> getServerInfo4(@Field("cusid") String cusid);

}
